#include "Process.h"

#include <string.h>
#include <fan-llvm/core/Core.h>
#include "Type.h"
#include "UnsupportedErr.h"


Type* Process_classType = NULL;
VTable* Process_classVTable = NULL;


/**********************************************
 *
 * Methods and fields
 *
 **********************************************/


/* Void make(Str[] cmd, File? dir) */
void Process_make_0(Process* self)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Process.make not implemented yet"));
}


/* Void make(Str[] cmd, File? dir) */
void Process_make_1(Process* self, List* cmd)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Process.make not implemented yet"));
}


/* Void make(Str[] cmd, File? dir) */
void Process_make(Process* self, List* cmd, File* dir)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Process.make not implemented yet"));
}


/* Str[] command */
List* Process_command(Process* self)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Process.command not implemented yet"));
}


/* Str[] command */
void Process_setCommand(Process* self, List* val)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Process.command not implemented yet"));
}


/* File? dir */
File* Process_dir(Process* self)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Process.dir not implemented yet"));
}


/* File? dir */
void Process_setDir(Process* self, File* val)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Process.dir not implemented yet"));
}


/* Bool mergeErr */
Bool Process_mergeErr(Process* self)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Process.mergeErr not implemented yet"));
}


/* Bool mergeErr */
void Process_setMergeErr(Process* self, Bool val)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Process.mergeErr not implemented yet"));
}


/* OutStream? out */
OutStream* Process_out(Process* self)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Process.out not implemented yet"));
}


/* OutStream? out */
void Process_setOut(Process* self, OutStream* val)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Process.out not implemented yet"));
}


/* OutStream? err */
OutStream* Process_err(Process* self)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Process.err not implemented yet"));
}


/* OutStream? err */
void Process_setErr(Process* self, OutStream* val)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Process.err not implemented yet"));
}


/* InStream? in */
InStream* Process_in(Process* self)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Process.in not implemented yet"));
}


/* InStream? in */
void Process_setIn(Process* self, InStream* val)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Process.in not implemented yet"));
}


/* [Str:Str] env() */
Map* Process_env(Process* self)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Process.env not implemented yet"));
}


/* This run() */
Process* Process_run(Process* self)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Process.run not implemented yet"));
}


/* Int join() */
Int Process_join(Process* self)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Process.join not implemented yet"));
}


/**********************************************
 *
 * Type-system functions
 *
 **********************************************/


Type* Process_initType(void)
{
  if (Process_classType == NULL)
  {
    Type* baseType = Obj_initType();
    VTable* vtable = Process_initVTable();
    Type* type = Type_new("Process", baseType, vtable, sizeof(Process), sizeof(ProcessVTable));
    Type_registerCtorImplementation(type, "make", Process_make_0, 0);
    Type_registerCtorImplementation(type, "make", Process_make_1, 1);
    Type_registerCtorImplementation(type, "make", Process_make, 2);
    Type_registerMethodImplementation(type, "env", Process_env, 0);
    Type_registerMethodImplementation(type, "join", Process_join, 0);
    Type_registerMethodImplementation(type, "run", Process_run, 0);
    Type_registerFieldImplementation(type, "command", Process_command, Process_setCommand);
    Type_registerFieldImplementation(type, "dir", Process_dir, Process_setDir);
    Type_registerFieldImplementation(type, "err", Process_err, Process_setErr);
    Type_registerFieldImplementation(type, "in", Process_in, Process_setIn);
    Type_registerFieldImplementation(type, "mergeErr", Process_mergeErr, Process_setMergeErr);
    Type_registerFieldImplementation(type, "out", Process_out, Process_setOut);
    Process_classType = type;
    Process_initStatic();
  }
  return Process_classType;
}


VTable* Process_initVTable(void)
{
  if (Process_classVTable == NULL)
  {
    VTable* vtable = memoryAlloc(sizeof(ProcessVTable));
    memcpy(vtable, Obj_initVTable(), sizeof(FanObjVTable));
    Process_classVTable = vtable;
  }
  return Process_classVTable;
}


void Process_initStatic(void)
{
}
